import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { UserHealthAssociationVO, UserHealthAssociationForm, UserHealthAssociationQuery } from '@/api/system/userHealthAssociation/types';

/**
 * 查询技师和健康关联列表
 * @param query
 * @returns {*}
 */

export const listUserHealthAssociation = (query?: UserHealthAssociationQuery): AxiosPromise<UserHealthAssociationVO[]> => {
  return request({
    url: '/system/userHealthAssociation/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询技师和健康关联详细
 * @param associationId
 */
export const getUserHealthAssociation = (associationId: string | number): AxiosPromise<UserHealthAssociationVO> => {
  return request({
    url: '/system/userHealthAssociation/' + associationId,
    method: 'get'
  });
};

/**
 * 新增技师和健康关联
 * @param data
 */
export const addUserHealthAssociation = (data: UserHealthAssociationForm) => {
  return request({
    url: '/system/userHealthAssociation',
    method: 'post',
    data: data
  });
};

/**
 * 修改技师和健康关联
 * @param data
 */
export const updateUserHealthAssociation = (data: UserHealthAssociationForm) => {
  return request({
    url: '/system/userHealthAssociation',
    method: 'put',
    data: data
  });
};

/**
 * 删除技师和健康关联
 * @param associationId
 */
export const delUserHealthAssociation = (associationId: string | number | Array<string | number>) => {
  return request({
    url: '/system/userHealthAssociation/' + associationId,
    method: 'delete'
  });
};
